/// <reference path="../base.js">
/// <reference path="../data/commodities.js">

/* Pardus Sector Tool
 * (C) Yassen 2010
 *
 * commodities.js
 * Defines functions for getting commodity information.
 *
 * Functions:
 * Commodity  GetByImage(img)
 *
 */

Utility.Commodities.GetByImage = function(img)
{
  /// <summary>Gets the commodity information by its image.</summary>
  /// <param name="img" type="String">Image of the commodity.</param>
  /// <returns type="Commodity">The Commodity</returns>

  for (var index in Global.Commodities)
  {
    var commodity = Global.Commodities[index];
    if (commodity.image == image)
      return commodity;
  }

  return undefined; // Didn't find it
}